package com.graduate.game.xiaogame.controller;

import com.graduate.game.topic.pojo.topic;
import com.graduate.game.topic.service.TopicService;
import com.graduate.game.xiaogame.pojo.unkonwn;
import com.graduate.game.xiaogame.service.unkonwnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
@ResponseBody
@RequestMapping("/unkonwn")
@CrossOrigin(origins = "*", maxAge = 3600)
public class unkonwnController {
    @Autowired
    public unkonwnService unkonwnService;
    @RequestMapping("/getOne")
    public unkonwn getOne(HttpServletRequest request, HttpServletResponse response) throws Exception {
        response.setHeader("Access-Control-Allow-Origin","*");
        unkonwn unkonwn = unkonwnService.randomOne();
        System.out.println(unkonwn);
        return unkonwn;
    }
}
